<?php
/**
 * Created by PhpStorm.
 * User: idcu
 * Date: 2016/3/15
 * Time: 10:25
 */
namespace Service\Model;
use IDCU\Model\RelationModel;

class OaDeptModel extends RelationModel
{
    protected $connection = array(
        'db_type'       =>  'mysql',
        'db_host'       =>  'oa.sxqtwy.com',
        'db_port'       =>  '3336',
        'db_name'       =>  'TD_OA',
        'db_user'       =>  'crm',
        'db_pwd'        =>  '!@#sa2015',
        'db_charset'    =>  'utf8',
        'db_debug'      =>  true,
    );
    protected $tablePrefix = '';
    protected $tableName = 'department';
    protected $_link = array(
//        'OaPriv' => array(
//            'mapping_type' => self::BELONGS_TO,
//            'mapping_name' => 'priv',
//            'foreign_key'   => 'USER_PRIV'
//        ),
        'OaUser' => array(
            'mapping_type' => self::BELONGS_TO,
            'mapping_name' => 'users',
            'foreign_key'   => 'DEPT_ID'
        ),
        'OaRun'  => array(
            'mapping_type' => self::HAS_MANY,
            'mapping_name' => 'runs',
            'foreign_key'   => 'BEGIN_DEPT'
        ),
    );
}